<?php

namespace app\modules\Admin\models;

use Yii;

/**
 * This is the model class for table "epidemic".
 *
 * @property int $id
 * @property string $ep_date 日期
 * @property int|null $epnum_1 现有确诊
 * @property int|null $epnum_2 无症状
 * @property int|null $epnum_3 现有疑似
 * @property int|null $epnum_4 现有重症
 * @property int|null $epnum_5 累计确诊
 * @property int|null $epnum_6 境外输入
 * @property int|null $epnum_7 累计治愈
 * @property int|null $epnum_8 累计死亡
 * @property int|null $status 1正常  2禁用
 * @property string|null $create_time
 * @property string|null $updated_at
 */
class Epidemic extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'epidemic';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['ep_date'], 'required'],
            [['ep_date', 'create_time', 'updated_at'], 'safe'],
            [['epnum_1', 'epnum_2', 'epnum_3', 'epnum_4', 'epnum_5', 'epnum_6', 'epnum_7', 'epnum_8', 'status'], 'integer'],
        ];
    }

    // 保存前处理
    public function beforeSave($insert) {//{{{

        if($insert){
            $this->create_time = date("Y-m-d H:i:s");
        }
        return parent::beforeSave($insert);
    }//}}}

    
    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'ep_date' => '日期',
            'epnum_1' => '现有确诊',
            'epnum_2' => '无症状',
            'epnum_3' => '现有疑似',
            'epnum_4' => '现有重症',
            'epnum_5' => '累计确诊',
            'epnum_6' => '境外输入',
            'epnum_7' => '累计治愈',
            'epnum_8' => '累计死亡',
            'status' => 'Status',
            'create_time' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }
}
